package com.syni.mdd.yhd.common.all.controller.protect;

import com.syni.mdd.sjb.common.component.utils.common.annotations.CheckParams;
import com.syni.mdd.yhd.common.all.service.BmsLocalLifeService;
import com.syni.mdd.sjb.common.component.utils.common.utils.ParamsMap;
import io.netty.util.internal.logging.Log4J2LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
* @author: huangwenquan
* @date:  2020/2/24 14:38
* @description:本地生活
*/
@RestController
@RequestMapping("/life")
public class BmsLocalLifeController {

    @Autowired
    BmsLocalLifeService bmsLocalLifeService;


    /**
    * @author: huangwenquan
    * @date:  2020/2/24 14:54
    * @description:获取本地生活列表
    */
    @PostMapping("/getLifeList")
    @CheckParams(params = {"page_num","page_size"})
    public Map<String,Object> getLifeList(@RequestBody Map<String,Object> paramsMap){
        Integer pageNum = Integer.parseInt(paramsMap.get("page_num").toString());
        Integer pageSize = Integer.parseInt(paramsMap.get("page_size").toString());
        return bmsLocalLifeService.getLifeList(pageNum,pageSize);
    }

    /**
     * @author: huangwenquan
     * @date:  2020/2/24 14:54
     * @description:获取本地生活列表
     */
    @PostMapping("/v2/getLifeList")
    @CheckParams(params = {"page_num","page_size"})
    public Map<String,Object> getLifeList_V2(@RequestBody Map<String,Object> paramsMap){
        Integer pageNum = Integer.parseInt(paramsMap.get("page_num").toString());
        Integer pageSize = Integer.parseInt(paramsMap.get("page_size").toString());
        return bmsLocalLifeService.getLifeList_V2(pageNum,pageSize);
    }

    /**
     * @author: huangwenquan
     * @date:  2020/2/24 14:54
     * @description:本地生活产品详情
     */
    @PostMapping("/productDetail")
    @CheckParams(params = {"lifeId"})
    public Map<String,Object> productDetail(@RequestBody ParamsMap paramsMap){
        return bmsLocalLifeService.productDetail(paramsMap);
    }

    /**
     * @author: huangwenquan
     * @date:  2020/2/24 14:54
     * @description:获取分享海报
     */
    @PostMapping("/getShareImg")
    @CheckParams(params = {"lifeId"})
    public Map<String,Object> getShareImg(@RequestBody ParamsMap paramsMap){
        return bmsLocalLifeService.getShareImg(paramsMap);
    }

    /**
     * @author: huangwenquan
     * @date:  2020/2/24 14:54
     * @description:获取对应购物列表
     */
    @PostMapping("/getLifeGoodsList")
    @CheckParams(params = {"lifeId"})
    public Map<String,Object> getLifeGoodsList(@RequestBody ParamsMap paramsMap){
        return bmsLocalLifeService.getLifeGoodsList(paramsMap);
    }


    /**
    * @author: huangwenquan
    * @date:  2020/2/28 10:33
    * @description:确认收货接口
    */
    @PostMapping("/cofirmGoods")
    @CheckParams(checkAuth = true,params = {"orderId"})
    public Map<String,Object> cofirmGoods(@RequestBody ParamsMap paramsMap){
        return bmsLocalLifeService.cofirmGoods(paramsMap);
    }

    /**
     * @author: huangwenquan
     * @date:  2020/2/24 14:54
     * @description:物流接口信息接口
     */
    @PostMapping("/getLogisticsInfo")
    @CheckParams(params = {"orderId"})
    public Map<String,Object> getLogisticsInfo(@RequestBody ParamsMap paramsMap){
        return bmsLocalLifeService.getLogisticsInfo(paramsMap);
    }
}
